<!--nav start-->
<div id="navigation">
    <div class="com">
        {if !empty($site.name)}
        <div class="nav-title">
            <a href="{:url('/index')}">{$site.name}</a>
        </div>
        {/if}
        <div class="nav-content">
            <ul>
                {volist name="navigationList" id="navigation"}
                <li {if $identify==$navigation.controllername} {if !empty($navigation.children)}class="active dropdown"{else/}class="active"{/if} {else/}{if !empty($navigation.children)}class='dropdown'{/if}  {/if}>
                    <a {if $navigation.link!=''}href="{$navigation.link}" {else/}href="javascript:void(0);"{/if}>{$navigation.name} {if !empty($navigation.children)}<span class="caret"></span>{/if} </a>
                    {if !empty($navigation.children)}
                        <ul class="dropdown-nav">
                            {volist name="navigation.children" id="child"}
                            <li><a {if $child.link!=''}href="{$child.link}" {else/}href='javascript:void(0);'{/if} >{$child.name}</a></li>
                            {/volist}
                        </ul>
                    {/if}
                </li>
                {/volist}
            </ul>

        </div>
        <div class="nav-search">
            <div class="input-box">
                <input type="text" name="keywords" placeholder="请输入关键词" {if !empty($keywords)}value="{$keywords}"{/if} />
            </div>
            <button type="button" class="btn-box search-btn">搜索</button>
        </div>
    </div>
</div>
<!--nav stop-->

<script type="text/javascript">
    $(function () {
        $('.search-btn').on('click',function () {
            var keywords=$('input[name=keywords]').val();
            location.href='/list/'+keywords;
        });

        // keydown，keypress，keyup，分别是按下，按着没上抬，上抬键盘
        $('input[name=keywords]').keyup(function () {
            if(event.keyCode ==13){
                var keywords=$('input[name=keywords]').val();
                location.href='/list/'+keywords;
            }
        })
    })
</script>